<?php

namespace App\Http\Requests;

use App\Http\Requests\Request;

class FrilkPostRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'flkws' => 'required|max:40',
            'flurl' => 'required|active_url',
            'editorValue' => 'required|max:800',
            'flpic' => 'image',
        ];
    }

    public function messages()
    {
        return [
            'flkws.required' => '友链关键词不能为空',
            'flkws.max' => '友链关键词字数超出限制',
            'flurl.required' => '友链网址不能为空',
            'flurl.active_url' => '请填写正确的友链网址',
            'editorValue.required' => '友链描述不能为空',
            'editorValue.max' => '友链描述字数超出限制',
            'flpic.image' => '请上传 jpeg、png、bmp、gif、 或 svg格式的图片'
        ];
    }
}
